package com.dnzx.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.dnzx.framework.orm.mybatis.MyBatisBaseServiceImpl;
import org.dnzx.framework.orm.mybatis.MybatisBaseDao;
import org.dnzx.framework.page.PageResult;
import org.springframework.stereotype.Service;

import com.dnzx.dao.IDictDao;
import com.dnzx.model.DictBO;
import com.dnzx.service.IDictService;

/**
 * @version 1.0
 */
@Service
public class DictServiceImpl extends MyBatisBaseServiceImpl<DictBO, Long>
		implements IDictService {

	@Resource
    private IDictDao dictDao;
    
    @Override
    public MybatisBaseDao<DictBO, Long> getBaseDAO() {
        return this.dictDao;
    }

    @Override
    public void save(DictBO dictBO) {
        this.dictDao.save(dictBO);
    }
    
    @Override
    public void delete(Long id) {
        this.dictDao.delete(id);
    }

    @Override
    public void update(DictBO dictBO) {
    }
    
    @Override
    public DictBO get(Long id) {
    	DictBO dictBO = this.dictDao.get(id);
    	return dictBO;
    }
    
    @Override
    public List<DictBO> queryList(DictBO dictBO) {
    	return this.dictDao.queryList(dictBO);
    }

    @Override
    public PageResult<List<DictBO>> queryPage(DictBO dictBO, PageResult<List<DictBO>> pageResult) {
        int totalRows = this.dictDao.queryCount(dictBO);
        pageResult.setTotalRows(totalRows);
        pageResult.setCurrentPage(dictBO.getCurrentPage());
        pageResult.setPageSize(dictBO.getPageSize());
		List<DictBO> records = this.dictDao.queryPage(pageResult.getPageSize(), pageResult.getStartRow(), dictBO);
		pageResult.setT(records);
		return pageResult;
    }
	
}
